package com.yonyou.pmclouds.alterandvisa.mapper;


import com.yonyou.pmclouds.alterandvisa.entity.AlterAndVisaListViewVO;
import com.yonyou.pmclouds.alterandvisa.entity.AlterAndVisaVO;
import com.yonyou.pmclouds.basecom.dao.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;


public interface AlterAndVisaMapper extends BaseMapper<AlterAndVisaVO> {
    @Select("select pk_alterandvisa, pk_altervisacategory, is_visa, apply_date, creator, creationtime, billstatus,estimate_mny from pm_alterandvisa where pk_project = #{pkProject} and dr = 0 order by creationtime desc")
    @ResultType(com.yonyou.pmclouds.alterandvisa.entity.AlterAndVisaListViewVO.class)
    AlterAndVisaListViewVO[] getListViewVOByProject(@Param("pkProject") String pkProject);

    @Select("select pk_alterandvisa, pk_altervisacategory, is_visa, apply_date, creator, creationtime, billstatus,estimate_mny from pm_alterandvisa where pk_alterandvisa in (${strIds}) and dr = 0 order by creationtime desc")
    @ResultType(com.yonyou.pmclouds.alterandvisa.entity.AlterAndVisaListViewVO.class)
    AlterAndVisaListViewVO[] getByIds(@Param("strIds") String strIds);
    /**
     * 请注意，这里的code不可使用模块之外传入的属性，避免sql注入
     */
    @Select("select count(*) from pm_alterandvisa where ${code} in  (${ids}) and dr = 0 ")
    int getRefByIds(@Param("code") String code, @Param("ids") String ids);

    AlterAndVisaVO[] queryByCondition(@Param("pkProjects")String[] pkProjects,
                                    @Param("creators") String[] creators,
                                    @Param("startDate") String startDate,
                                    @Param("endDate") String endDate,
                                    @Param("billStatus") int[] billStatus,
                                    @Param("start") int start,
                                    @Param("size") int size);
    int countByCondition(@Param("pkTenant") String pkTenant,
                         @Param("pkProjects")String[] pkProjects,
                         @Param("creators") String[] creators,
                         @Param("startDate") String startDate,
                         @Param("endDate") String endDate,
                         @Param("billStatus") int[] billStatus);
}
